<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function getSum(num1, num2) {
        let i = num1.length - 1,
          j = num2.length - 1,
          carry = 0
        const res = []
        while (i >= 0 || j >= 0 || carry > 0) {
          const a = i >= 0 ? +num1[i] : 0
          const b = j >= 0 ? +num2[j] : 0
          const sum = a + b + carry
          res.unshift(sum % 10)
          carry = Math.floor(sum / 10)
          i--
          j--
        }
        return res.join('')
      }
      console.log(getSum('99', '1'))
    </script>
  </body>
</html>
